var mongoose = require('mongoose')
var Schema = mongoose.Schema
var EvaluationSchemaConfig = {
  versionKey: false,
  timestamps: {
    createdAt: 'created_at',
    updatedAt: false
  }
}

/***************************
 * 综合测评当前状态stage说明：
 * *************************
 * 1. 已发布
 * 2. 接收材料（唯一学生可以修改材料阶段）
 * 3. 审核材料
 * 4. 结束审核
 * 5. 开始申报（唯一学生可以申报奖项阶段）
 * 6. 结束申报
 ***************************/
var EvaluationSchema = new Schema({
  name: String,
  stage: {type: Number, default: 1, min: 1},
  scholarships: [{
    name: String,
    applicants: [{type: Schema.Types.ObjectId, ref: 'User'}]
  }],
  buckets: [{type: Schema.Types.ObjectId, ref: 'EvaluationBucket'}],
  delete: {type: Boolean, default: false}
}, EvaluationSchemaConfig)

exports = module.exports = EvaluationSchema
